package com.shop.shoppingmall.controller;

import com.shop.shoppingmall.entity.ShCheck;
import com.shop.shoppingmall.service.ShCheckService;
import com.shop.shoppingmall.util.VideoRecode;
import com.shop.shoppingmall.util.api.vo.Result;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 实名认证(ShCheck)表控制层
 *
 * @author makejava
 * @since 2020-09-05 14:21:42
 */
@RestController
@RequestMapping("shCheck")
@CrossOrigin
public class ShCheckController {
    /**
     * 服务对象
     */
    @Resource
    private ShCheckService shCheckService;



    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public ShCheck selectOne(String id) {
        return this.shCheckService.queryById(id);
    }


    /**
     * 进行实名认证
     * @param request
     * @param imgFile
     * @return
     */
    @PostMapping("/checkPerson")
    public Result checkPerson(HttpServletRequest request , MultipartFile imgFile){
        return shCheckService.checkPerson(request,imgFile);
    }

    @PostMapping("/checkReal")
    public Result checkReal(HttpServletRequest request ,String idCard ,String name){
        return shCheckService.checkReal(request,idCard,name);
    }

    /**
     * 根据userId查询实名认证的相关信息
     * @param request
     * @return
     */
    @GetMapping("/selectShCheckByUserId")
    public Result selectShCheckByUserId(HttpServletRequest request){
        return shCheckService.selectShCheckByUserId(request);
    }

}
